#include <cellcsp.h>
#include <string>
#include <stdio.h>
#include <csp_debug.h>




int main(){

	int block_all_dma=0, clear_spe_mem=0;

#ifdef BLOCK_ALL_DMA
	block_all_dma=1;
#endif

#ifdef CLEAR_SPE_MEM
	clear_spe_mem=1;
#endif

	ASSERT( block_all_dma );
	ASSERT( clear_spe_mem );

	CSPConfig conf;


	char *ct_consumer_mnemonic = "ct_consumer";
	char    *ct_delta_mnemonic = "ct_delta";
	char *ct_identity_mnemonic = "ct_identity";
	char   *ct_prefix_mnemonic = "ct_prefix";
	char *ct_succesor_mnemonic = "ct_succesor";

	char *ct_consumer_path = "./tasks/ct_consumer";
	char    *ct_delta_path = "./tasks/ct_delta";
	char *ct_identity_path = "./tasks/ct_identity";
	char   *ct_prefix_path = "./tasks/ct_prefix";
	char *ct_succesor_path = "./tasks/ct_succesor";




	conf.add_csp_program(ct_consumer_path, ct_consumer_mnemonic); 
	conf.add_csp_program(   ct_delta_path,    ct_delta_mnemonic);
	conf.add_csp_program(ct_identity_path, ct_identity_mnemonic);
	conf.add_csp_program(  ct_prefix_path,   ct_prefix_mnemonic);
	conf.add_csp_program(ct_succesor_path, ct_succesor_mnemonic);


	CellCSP_start(conf);

	printf("COMMSTIME benchmark.\n");

	Parallel par(
			new CSPProcess(ct_consumer_mnemonic),
			new CSPProcess(   ct_delta_mnemonic),
			new CSPProcess(  ct_prefix_mnemonic),
			new CSPProcess(ct_succesor_mnemonic),
			NULL);
	par.Run();

	CellCSP_end();

	return 0;
}
